#include<iostream>
#include<algorithm>
#include<vector>

using std::vector;
using std::pair;
using std::make_pair;
using std::iter_swap;
using std::cin;
using std::cout;
using std::endl;
using std::distance;

template <typename T>
void Input(vector<T> &v, int &separator) {
    size_t size;
    cin >> size;
    v.resize(size);
    for (size_t i = 0; i < size; ++i) {
        cin >> v[i];
    }
    cin >> separator;
}

template<typename T>
T partition(T left, T right, int separator) {
    if (left == right)
        return left;
    auto begin = left;
    auto res = left;
    while (left < right) {
        if (*left >= separator) {
            ++left;
        }
        else {
            iter_swap(left, res);
            ++res;
            ++left;
        }
    }
    return res;
}

template<typename T>
void Output(vector<T> &v, int separator) {
    auto res = partition(v.begin(), v.end(), separator);
    int less = distance(v.begin(), res);
    if (v.begin() == v.end())
    {
        cout << "0" << endl << "0";
        return;
    }
    if (v.end() - 1 == res && *res < separator)
        ++less;
    cout << less << endl;;
    cout << v.size() - less;
}

int main() {
    vector<int> v;
    int separator = 0;

    Input(v, separator);
    Output(v, separator);
}